home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Tools - Objects / MacApp / MacApp 3.0a2 / CPlusIncludes / Fonts.h < prev    next >
Text File  |  1991-05-01  |  7KB  |  268 lines

  1. /************************************************************
  2.  
  3. Created: Saturday, January 26, 1991 at 10:45 PM
  4.     Fonts.h
  5.     C Interface to the Macintosh Libraries
  6.  
  7.  
  8.         Copyright Apple Computer, Inc.    1985-1990
  9.         All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13.  
  14. #ifndef __FONTS__
  15. #define __FONTS__
  16.  
  17. #ifndef __TYPES__
  18. #include <Types.h>
  19. #endif
  20.  
  21. #ifndef __GEOMETRY__
  22. #include <Geometry.h>
  23. #endif
  24.  
  25.  
  26. enum {
  27.  
  28.     systemFont = 0,
  29.     applFont = 1,
  30.     newYork = 2,
  31.     geneva = 3,
  32.     monaco = 4,
  33.     venice = 5,
  34.     london = 6,
  35.     athens = 7,
  36.     sanFran = 8,
  37.     toronto = 9,
  38.     cairo = 11,
  39.     losAngeles = 12,
  40.     times = 20,
  41.     helvetica = 21,
  42.     courier = 22,
  43.     symbol = 23,
  44.     mobile = 24,
  45.     commandMark = 17,
  46.     checkMark = 18,
  47.     diamondMark = 19
  48. };
  49. enum {
  50.     appleMark = 20,
  51.     propFont = 36864,
  52.     prpFntH = 36865,
  53.     prpFntW = 36866,
  54.     prpFntHW = 36867,
  55.     fixedFont = 45056,
  56.     fxdFntH = 45057,
  57.     fxdFntW = 45058,
  58.     fxdFntHW = 45059,
  59.     fontWid = 44208
  60. };
  61.  
  62. struct FMInput {
  63.     short family;
  64.     short size;
  65.     Style face;
  66.     Boolean needBits;
  67.     short device;
  68.     Point numer;
  69.     Point denom;
  70. };
  71.  
  72. struct FMOutput {
  73.     short errNum;
  74.     Handle fontHandle;
  75.     unsigned char boldPixels;
  76.     unsigned char italicPixels;
  77.     unsigned char ulOffset;
  78.     unsigned char ulShadow;
  79.     unsigned char ulThick;
  80.     unsigned char shadowPixels;
  81.     char extra;
  82.     unsigned char ascent;
  83.     unsigned char descent;
  84.     unsigned char widMax;
  85.     char leading;
  86.     char unused;
  87.     Point numer;
  88.     Point denom;
  89. };
  90.  
  91. typedef FMOutput *FMOutPtr;
  92.  
  93. struct FontRec {
  94.     short fontType;         /*font type*/
  95.     short firstChar;        /*ASCII code of first character*/
  96.     short lastChar;         /*ASCII code of last character*/
  97.     short widMax;           /*maximum character width*/
  98.     short kernMax;          /*negative of maximum character kern*/
  99.     short nDescent;         /*negative of descent*/
  100.     short fRectWidth;       /*width of font rectangle*/
  101.     short fRectHeight;      /*height of font rectangle*/
  102.     short owTLoc;           /*offset to offset/width table*/
  103.     short ascent;           /*ascent*/
  104.     short descent;          /*descent*/
  105.     short leading;          /*leading*/
  106.     short rowWords;         /*row width of bit image / 2 */
  107. };
  108.  
  109. typedef struct FontRec FontRec;
  110.  
  111. struct FMetricRec {
  112.     Fixed ascent;           /*base line to top*/
  113.     Fixed descent;          /*base line to bottom*/
  114.     Fixed leading;          /*leading between lines*/
  115.     Fixed widMax;           /*maximum character width*/
  116.     Handle wTabHandle;      /*handle to font width table*/
  117. };
  118.  
  119. typedef struct FMetricRec FMetricRec;
  120.  
  121. struct WidEntry {
  122.     short widStyle;         /*style entry applies to*/
  123. };
  124.  
  125. typedef struct WidEntry WidEntry;
  126.  
  127. struct WidTable {
  128.     short numWidths;        /*number of entries - 1*/
  129. };
  130.  
  131. typedef struct WidTable WidTable;
  132.  
  133. struct AsscEntry {
  134.     short fontSize;
  135.     short fontStyle;
  136.     short fontID;           /*font resource ID*/
  137. };
  138.  
  139. typedef struct AsscEntry AsscEntry;
  140.  
  141. struct FontAssoc {
  142.     short numAssoc;         /*number of entries - 1*/
  143. };
  144.  
  145. typedef struct FontAssoc FontAssoc;
  146.  
  147. struct StyleTable {
  148.     short fontClass;
  149.     long offset;
  150.     long reserved;
  151.     char indexes[48];
  152. };
  153.  
  154. typedef struct StyleTable StyleTable;
  155.  
  156. struct NameTable {
  157.     short stringCount;
  158.     Str255 baseFontName;
  159. };
  160.  
  161. struct KernPair {
  162.     char kernFirst;         /*1st character of kerned pair*/
  163.     char kernSecond;        /*2nd character of kerned pair*/
  164.     short kernWidth;        /*kerning in 1pt fixed format*/
  165. };
  166.  
  167. typedef struct KernPair KernPair;
  168.  
  169. struct KernEntry {
  170.     short kernLength;       /*length of this entry*/
  171.     short kernStyle;        /*style the entry applies to*/
  172. };
  173.  
  174. typedef struct KernEntry KernEntry;
  175.  
  176. struct KernTable {
  177.     short numKerns;         /*number of kerning entries*/
  178. };
  179.  
  180. typedef struct KernTable KernTable;
  181.  
  182. struct WidthTable {
  183.     Fixed tabData[256];     /*character widths*/
  184.     Handle tabFont;         /*font record used to build table*/
  185.     long sExtra;            /*space extra used for table*/
  186.     long style;             /*extra due to style*/
  187.     short fID;              /*font family ID*/
  188.     short fSize;            /*font size request*/
  189.     short face;             /*style (face) request*/
  190.     short device;           /*device requested*/
  191.     Point inNumer;          /*scale factors requested*/
  192.     Point inDenom;          /*scale factors requested*/
  193.     short aFID;             /*actual font family ID for table*/
  194.     Handle fHand;           /*family record used to build up table*/
  195.     Boolean usedFam;        /*used fixed point family widths*/
  196.     unsigned char aFace;    /*actual face produced*/
  197.     short vOutput;          /*vertical scale output value*/
  198.     short hOutput;          /*horizontal scale output value*/
  199.     short vFactor;          /*vertical scale output value*/
  200.     short hFactor;          /*horizontal scale output value*/
  201.     short aSize;            /*actual size of actual font used*/
  202.     short tabSize;          /*total size of table*/
  203. };
  204.  
  205. struct FamRec {
  206.     short ffFlags;          /*flags for family*/
  207.     short ffFamID;          /*family ID number*/
  208.     short ffFirstChar;      /*ASCII code of 1st character*/
  209.     short ffLastChar;       /*ASCII code of last character*/
  210.     short ffAscent;         /*maximum ascent for 1pt font*/
  211.     short ffDescent;        /*maximum descent for 1pt font*/
  212.     short ffLeading;        /*maximum leading for 1pt font*/
  213.     short ffWidMax;         /*maximum widMax for 1pt font*/
  214.     long ffWTabOff;         /*offset to width table*/
  215.     long ffKernOff;         /*offset to kerning table*/
  216.     long ffStylOff;         /*offset to style mapping table*/
  217.     short ffProperty[9];    /*style property info*/
  218.     short ffIntl[2];        /*for international use*/
  219.     short ffVersion;        /*version number*/
  220. };
  221.  
  222. typedef struct FamRec FamRec;
  223.  
  224.  
  225. #ifdef __cplusplus
  226. extern "C" {
  227. #endif
  228. pascal void InitFonts(void)
  229.     = 0xA8FE; 
  230. pascal void GetFontName(short familyID,Str255& name)
  231.     = 0xA8FF; 
  232. pascal void GetFNum(ConstStr255Param name,short& familyID)
  233.     = 0xA900; 
  234. pascal Boolean RealFont(short fontNum,short size)
  235.     = 0xA902; 
  236. pascal void SetFontLock(Boolean lockFlag)
  237.     = 0xA903; 
  238. pascal FMOutPtr FMSwapFont(const FMInput& inRec)
  239.     = 0xA901; 
  240. pascal void SetFScaleDisable(Boolean fscaleDisable)
  241.     = 0xA834; 
  242. pascal void FontMetrics(const FMetricRec& theMetrics)
  243.     = 0xA835; 
  244. pascal void SetFractEnable(Boolean fractEnable); 
  245. pascal Boolean IsOutline(Point numer,Point denom)
  246.     = {0x7000,0xA854}; 
  247. pascal void SetOutlinePreferred(Boolean outlinePreferred)
  248.     = {0x7001,0xA854}; 
  249. pascal Boolean GetOutlinePreferred(void)
  250.     = {0x7009,0xA854}; 
  251. pascal OSErr OutlineMetrics(short byteCount,const void *textPtr,Point numer,
  252.     Point denom,short& yMax,short& yMin,FixedPtr awArray,FixedPtr lsbArray,
  253.     RectPtr boundsArray)
  254.     = {0x7008,0xA854}; 
  255. pascal void SetPreserveGlyph(Boolean preserveGlyph)
  256.     = {0x700A,0xA854}; 
  257. pascal Boolean GetPreserveGlyph(void)
  258.     = {0x700B,0xA854}; 
  259. pascal OSErr FlushFonts(void)
  260.     = {0x700C,0xA854}; 
  261. void getfnum(char *theName,short *familyID); 
  262. void getfontname(short familyID,char *theName); 
  263. #ifdef __cplusplus
  264. }
  265. #endif
  266.  
  267. #endif
  268.